$(function () {
    window.onload = function () {
        $('.nav-none').hide();
        $('.but').click(function () {
            $('.nav1-div').hide();
            $('.nav-none').show();
        })
        $('.none-but1').click(function () {
            $('.nav-none').hide();
            $('.nav1-div').show();
        })
        $('.ul-li1').click(function () {
            $('.main-new').show();
            $('.main-hot').hide();
            $('.main-play').hide();
        })
        $('.ul-li2').click(function () {
            $('.main-hot').show();
            $('.main-new').hide();
            $('.main-play').hide();
        })
        $('.ul-li3').click(function () {
            $('.main-play').show();
            $('.main-hot').hide();
            $('.main-new').hide();
        })
        $('.main-new').hide();
        $('.main-hot').hide();
        $('.main-play').show();
        $.ajax({
            url: 'http://localhost:3000/play/new',
            type: 'get',
            success: function (res) {
                var str = '';
                $.each(res, function (index, item) {
                    $.each(item, function (index1, item1) {
                        if (index1 == 3 || index1 == 7) {
                            str += "<div class='main-new di main-new1'>" +
                                "<img src='" + item1.img + "'class='div-img'>" +
                                "<div class='div-text'>" + item1.text + "</div>" +
                                "<div class='div-description f12'>" + item1.description + "</div>" +
                                "<div class='div-bottom'>" +
                                "<div class='bottom-money fl'>" + item1.price + "</div>" +
                                "<div class='bottom-right fr'>" +
                                "<img src='../css/img/xin.png'  class='xin'>" +
                                "<div class='bottom-words di'>" + item1.words + "</div>" +
                                "<img src='../css/img/zan.png'  class='zan'>" +
                                "<div class='bottom-like  di'>" + item1.like + "</div>" +
                                "</div></div></div>"
                        } else {
                            str += "<div class='main-new di'>" +
                                "<img src='" + item1.img + "'class='div-img'>" +
                                "<div class='div-text'>" + item1.text + "</div>" +
                                "<div class='div-description f12'>" + item1.description + "</div>" +
                                "<div class='div-bottom'>" +
                                "<div class='bottom-money fl'>" + item1.price + "</div>" +
                                "<div class='bottom-right fr'>" +
                                "<img src='../css/img/xin.png'  class='xin'>" +
                                "<div class='bottom-words di'>" + item1.words + "</div>" +
                                "<img src='../css/img/zan.png'  class='zan'>" +
                                "<div class='bottom-like  di'>" + item1.like + "</div>" +
                                "</div></div></div>"
                        }

                    })
                })
                $('.main-div').html(str)
            }
        })
        $.ajax({
            url: 'http://localhost:3000/play/category',
            type: 'get',
            success: function (res) {
                var arr0 = res[0];
                var arr1 = res[1];
                var arr2 = res[2];
                var arr3 = res[3];
                var arr4 = res[4];
                var arr5 = res[5];
                var str0 = '';
                var str1 = '';
                var str2 = '';
                var str3 = '';
                var str4 = '';
                var str5 = '';
                $.each(arr0, function (index, item) {
                    console.log(item);
                })
                $.each(arr1, function (index, item) {

                })
                $.each(arr2, function (index, item) {

                })
                $.each(arr3, function (index, item) {

                })
                $.each(arr4, function (index, item) {

                })
                $.each(arr5, function (index, item) {

                })
            }
        })
    }
})